// pages/shouye/sousuo/sousuo.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    inputValue:"",
    findList: [],
    findFlag: true
  },

  peopleOne() {
    wx.switchTab({
      url: '/pages/consult/consult',
    })
  },
  peopleTwo() {
    wx.navigateTo({
      url: '/pages/first/shouye/wenzhang/wenzhang',
    })
  },
  peopleThree() {
    wx.navigateTo({
      url: '/pages/first/shouye/ceping/ceping',
    })
  },
  peopleFour() {
    wx.navigateTo({
      url: '/pages/first/shouye/dayi/dayi',
    })
  },
  fanhui() {
    wx.switchTab({
      url: '/pages/first/first',
    })
  },
  qingkong() {
    var that = this;
    wx.request({
      url: 'http://localhost:8081/find/setDel',
      method: "POST",
      data: {
        historyList: that.data.list
      },
      header: {
        'content-type': 'application/json'
      },
      success() {
        that.setData({
          list: []
        });
      }
    });

  },
  findText(e) {
    this.setData({
      inputValue: e.detail.value
    })
  },
  findCha() {
    var that = this;
    console.log(that.data.inputValue)
    wx.request({
      url: 'http://localhost:8081/find/text',
      method: "POST",
      data: {
        getText: that.data.inputValue
      },
      success(res) {
        console.log(res.data.data)
        that.setData({
          findList: res.data.data,
          findFlag: false
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    var that = this;
    wx.request({
      url: 'http://localhost:8081/find/history',
      success(res) {
        that.setData({
          list: res.data.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})